package com.wc.blue_bridge_history.JavaLast.B_鸡哥的奇特密码;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/4/7 16:37
 * @description https://www.lanqiao.cn/paper/3998/problem/4125/
 */
public class Main {
    static int N = 10010;
    static char[] s = new char[N];

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        s = (" " + sc.next()).toCharArray();
        int n = s.length - 1;
        for(int i = 1; i <= n; i++){
            if (s[i] == 'Q' || s[i] == 'L' && s[i] != s[i - 1]){
                System.out.print(s[i]);
            }
        }
    }
}
